//
//  OrderDetCell.m
//  YaDiuDiu
//
//  Created by 欧洪飞 on 2017/8/21.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "OrderDetCell.h"

@implementation OrderDetCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setOrderDetData:(NSDictionary *)dic{
    NSString *orderName = [dic objectForKey:@"paymentdirection"];
    [self.labTitle setText:orderName];
    NSString *time = [dic objectForKey:@"changetime"];
    [self.labDate setText:[self getyYearsTimeFormat:time]];
    NSString *yue = [dic objectForKey:@"presentvalue"];
    [self.labyue setText:[NSString stringWithFormat:@"余额：%@",yue]];
    NSInteger changetype = [[dic objectForKey:@"changetype"] integerValue];
    NSString *money = [dic objectForKey:@"changesum"];
    if (changetype == 2) {
        [self.labMoney setText:[NSString stringWithFormat:@"+%@",money]];
    }else{
        [self.labMoney setText:[NSString stringWithFormat:@"-%@",money]];
    }
}

- (NSString *)getyYearsTimeFormat:(NSString *)dateString{
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:[dateString integerValue]];
    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"YYYY-MM-dd hh:mm:ss"];
    NSString *timeStr = [df stringFromDate:date];
    return timeStr;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
